package com.jinsi.controller.tang;

import com.jinsi.constant.YltConstant;
import com.jinsi.pojo.InfoDataUser;
import com.jinsi.service.tang.iml.CommodityStatisticsServiceImpl;
import com.jinsi.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 商品统计展示
 * @author 唐文博
 * @Date 2022-09-03
 */
@RestController
@RequestMapping("/commodityStatistics")
public class CommodityStatisticsController {
    @Autowired
    private CommodityStatisticsServiceImpl commodityStatisticsServiceImpl;

    /**
     * 获取7天内每天商品上架、下架和删除的个数
     * @param commodityState
     * @return
     */
    @RequestMapping("/getCommodityStatistics")
    public R getCommodityStatistics(Integer commodityState){
        List<InfoDataUser> list = commodityStatisticsServiceImpl.getCommodityStatistics(commodityState);
        return R.custom(YltConstant.LAYUI_CODE,
                YltConstant.LAYUI_MSG,
                list,
                (long) list.size());
    }
}
